using System;
using UnityEngine;

namespace Gj.HexMap
{
    public class Demo
    {
        public static void Direction()
        {
            var center = new Vector2Int(0, 2);
            var result = new Vector2Int();
            HexCube.AddDirection(center, HexDirectionRow.N, ref result);
            Console.Write(result);
        }

        public static void Rotate()
        {
            var center = new Vector2Int(0, 2);
            var result = new Vector2Int();
            HexCube.AddDirection(center, HexDirectionRow.N, ref result);
            Console.Write(HexCube.Rotate(center, result, 60));
            HexCube.AddDirection(center, HexDirectionRow.NE, ref result);
            Console.Write(HexCube.Rotate(center, result, 60));
        }

        public static void Range()
        {
            var center = new Vector2Int(0, 0);
            var list = HexCube.BaseRange(center);
            foreach (var p in list) Debug.LogError(p);
            // Console.WriteLine(HexCube.FromOffset(p));
        }

        public static void Ring()
        {
            var center = new Vector2Int(0, 0);
            var list = HexCube.DistanceRing(center, 2);
            foreach (var p in list) Console.WriteLine(HexCube.FromOffset(p));
        }

        public static void IsTurn()
        {
            var start = new Vector2Int(3, 1);
            var middle = new Vector2Int(3, 0);
            var end = new Vector2Int(2, 0);
            var startCube = HexCube.FromOffset(start);
            var middleCube = HexCube.FromOffset(middle);
            var endCube = HexCube.FromOffset(end);
            Console.WriteLine(start + " : " + startCube);
            Console.WriteLine(middle + " : " + middleCube);
            Console.WriteLine(end + " : " + endCube);

            var direction1 = HexCube.ToDirection(startCube, middleCube);
            var direction2 = HexCube.ToDirection(middleCube, endCube);
            Console.WriteLine("direction:" + direction1 + "," + direction2);
            var d = HexDirectionExtensions.Offset(direction1, direction2);
            Console.WriteLine(d);
        }
    }
}